# Import Dataset
import math
import time
import pandas as pd
import matplotlib.pyplot as plt
import numpy as np
import seaborn as sns
import pickle as p
from matplotlib.pyplot import MultipleLocator
import matplotlib.ticker as ticker
fig_name = time.time()
f = open('./result_model_1_multimer.pkl', 'rb')
b = p.load(f)
b2 = list(b)  # 将b转换为list类型，才能转换成numpy类型
# print(b2)

dict = {}
for i in range(len(b['predicted_aligned_error'])):
    dict[str(i)] = b['predicted_aligned_error'][i]
df = pd.DataFrame(dict)
# print(df)


plt.figure(figsize=(42,36), dpi= 300)
# Decorations
# plt.tick_params(labelsize=72)
plt.xticks(fontsize=56,rotation=90)
plt.yticks(fontsize=56)

# Plot
h = sns.heatmap(df, cmap='afmhot', center=0, annot=False,cbar=False,xticklabels='auto', yticklabels='auto')

cb = h.figure.colorbar(h.collections[0])
cb.ax.tick_params(labelsize=56)
plt.title('Predicted Aligned Error', fontsize=112)
plt.xlabel('Scored Residue', fontsize=96)
plt.ylabel('Aligned Residue', fontsize=96)
plt.savefig('./{}.png'.format(fig_name))
plt.show()
